home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
CLPMOUSE.ARJ
/
WIND.DOC
< prev
next >
Wrap
Text File
|
1991-01-21
|
10KB
|
244 lines
WINDOWS for CLIPPER 5.0 (c) Matthew S. Staben 1991
-----------------------
Unfortunately, with the release of CLIPPER 5.0, no real windowing functions
were implemented which would have made the screen layouts much easier to work
with. To make up for what is lacking, I have programmed (for all audiences)
a series of functions which utilize the functions which CLIPPER 5.0 did have
for the programmer who needs a windowing environment without having to program
it all.
Essential Information on the windowing capabilities:
Memory requirements above the LOAD size:
The only requirement for memory is that a maximum of characters which will fit
on the screen must have a buffer of the same size. This can be calculated by
the following function:
------------------------------------------
FUNCTION MAX_FLASH
/* To return the number of bytes */
/* which will be needed to guarantee */
/* correct operation. */
return(64+(maxrow()*maxcol())
------------------------------------------
The size returned by this function is the "FLASH POTENTIAL" factor. To
guarantee successful running of these functions, this flash potential *must*
be compensated for. For WINMOVE, WINMOVETO, WINSWAP, multiply the value by 2.
Other than this, all windowing is virtually stacked into a disk file, either in
the current directory or the SWAPPATH directory. The windowing file is limited
only by diskspace. Due to the efficient nature of programming, disk caching or
using a RAM drive will affect performance only by a small degree unless the
program is entirely floppy based.
The stack is a "LIFO" stack. Only the last opened window may be closed,
freeing the stack information beneath. One command, "WINSWAP()" will swap
the last two stack entries, thus making the 2nd to last window opened, the
last one.
All CLIPPER functions which had some form of screen output, except for the
savescreen() and restscreen() functions have been supplemented to. A library
file contains the following functions:
NOTE: These functions will work in any screen mode, except that shadows will
not appear in 40 columns since shadows ARE attribute changes.
WININIT(<expC>,<expL>)
This will initialize all windowing environment needs. In order to use any
windowing capabilities, this command must be used first.
<expC> specifies a filename to be used as the windows file.
<expL> specifies whether or not the SWAPPATH statement should be used.
ie, WININIT("WINFIL.WIN",.T.)
** This requires two (2) RESERVED words. WINHNDL and WINFIL. Using these two
as variables will cause the system to fail.
WINDONE()
This will close down all windowing environment settings caused by WININIT().
Essentially, it erases the windows file.
ie, WINDONE()
Returns (.T.) if successful, (.F.) if not.
WINBACK(<expC>)
This function will create a background for the windows to use. This is termed
as a window.
<expC> must be a single character.
ie, WINBACK(chr(177))
** Don't forget to set your colors!
WINOPEN(<expN1>,<expN2>,<expN3>,<expN4>,<expL1>[,<expC1>,<expC2>])
This function will open a window at the specified N1,N2 coordinates, which is
N3 tall and N4 wide. <expL1> is the shadow toggle, <expC1> is the title of
the window (which is centered on the top line, and <expC2> is the color for
the window title.
ie, WINOPEN(10,5,12,30,.f.,"Window 1",title_color)
* IF <expL1> is set to TRUE, the window is a color BOX with NO shadow. If it
it is FALSE, the window is a color AREA with a shadow.
** The color of the window is determined by the current color setting. The
color of the title is the foreground with the window color's background.
WINCLOSE(<expN>)
This function will close the last opened window for <expN> times. If <expN>
is omitted, one (1) is assumed.
ie, WINCLOSE(5) -- WINCLOSE()
WINSIZE(<expN1>,<expN2>[,<expL1>])
This function will size a the current window based on two separate types of
parameters. If (expL1) is TRUE, the N1 and N2 parameters are relative,
otherwise they are actual (as in WINOPEN). This will attempt to preserve the
data in the window. (if <expL1> is omitted, it defaults to TRUE.)
ie, WINSIZE(-5,-5,.T.) => This will shrink a window by five rows and columns.
WINSIZE(5,5,.T.) => This will enlarge a window by five rows and columns.
WINSIZE(10,33,.F.) => This will force the window to 10 rows and columns.
WINTOTAL()
This function will return the number of opened windows.
ie, total = WINTOTAL()
WINSWAP()
This function will cause the last two windows opened to be swapped so that
the writing routines may be used on alternate windows.
WINMOVE(<expN1>,<expN2>)
This function will move the last opened window N1 columns to the vertical,
and N2 columns to the horizontal.
ie, WINMOVE(-5,3) -- WINMOVE(2,5)
** This will move the window to the edges of the screen, but no more. To
move a window to the extreme edges of the screen, use a larger than real
number.
WINMOVETO(<expN1>,<expN2>,<expN3>)
This function will move the last opened window to the X,Y coordinates held in
<expN1> and <expN2>. <expN3> is the number of steps to take while going to
the new coordinates. The higher the number, the smoother the move is.
ie, WINMOVETO(5,2,5) -- WINMOVETO(1,1,8)
WINSAY(<expN1>,<expN2>,<expV1>[,<expC2>])
This function emulates an @ SAY command with an offset to the window instead
of the actual screen coordinates. <expC2> is the picture string which must be
enclosed in quotes.
ie, WINSAY(1,1,"$ and cents : ") -- WINSAY(1,20,value+(value*.78),"@)")
WINGET(<expN1>,<expN2>,<expC1>,<expC2>[,<expC3>])
This function emulates an @ SAY GET command with an offset to the window
specified by N1'th row, N2'th column instead of the actual screen coordinates.
<expC1> is the quotation to say, and <expC2> is the variable name (in quotes).
<expC3> is the picture string which must be enclosed in quotes.
ie, WINGET(1,1,"Enter $ and cents : ","value","9999.99")
WINPROMPT(<expN1>,<expN2>,<expC1>[,<expC2>])
This function emulates an @ PROMPT command with an offset in the window
instead of the actual screen coordinates. N1'th row, N2'th column, <expC1> is
the prompt's string, <expC2> is the message string which must be enclosed in
quotes.
ie, WINPROMPT(1,1,"0. Enter Database","This will enter the database")
WINPROMPT(2,1,"1. Quit to DOS")
MENU TO _vbl
WINBOX(<expN1>,<expN2>,<expN3>,<expN4>,<expC>)
This function emulates the @ X,Y,X1,Y1 BOX "ccccccccc" command. The box will
be displayed in the window's coordinate system. The <expC> must be provided.
Refer to the documentation for the correct string format.
ie, WINBOX(1,1,5,5,box_frame)
WINCLEARTO(<expN1>,<expN2>,<expN3>,<expN4>)
This function emulates the @ X,Y clear to X1,Y1 command. The cleared area will
remain within the windows coordinate system.
ie, WINCLEARTO(1,2,3,8)
WINLINE(<expN1>,<expN2>,<expN3>,<expN4>[,<expN5>])
This function emulates the @ X,Y to X1,Y1 single/DOUBLE command. <expN5>
defaults to single line if not specified. A two (2) for <expN5> will result
in a double line, a one (1) single.
ie, WINLINE(1,3,1,5,2)
WINCLEAR()
This function will clear the current window.
ie, WINCLEAR()
WINCOLOR(<expN>)
This function will change the color attributes by <expN> values. Refer to the
IBM Technical manual for more information on attribute colors. This does NOT
require the ANSI.SYS sub-program to be loaded.
ie, WINCOLOR(8)
* BONUS FUNCTION *
WIN_SGRAPH(<expN1>,<expN2>,<expN3>,<expC1>[,<expN4>,<expN5>,<expN6>,<expC2>)
This function has three different modes.
1. Start Graph. ie, win_sgraph(0,0,1,color_var,row,column,width,wording)
2. Update Graph. ie, win_sgraph(total,current,2,color_var)
3. End of Graph. ie, win_sgraph(0,0,3)
The graph is adjusted according to the width specified. An idea graph
situation would be as follows:
This function opens the graph as a window with NO shadow. So, it is
recommended that no other screen updates are used since it would require
a winswap() call.
win_sgraph(0,0,1,color_status,10,25,50,"Reading Database")
do while .not. eof() .and. win_sgraph(reccount(),recno(),2,color_status)
<statements>
skip
enddo
win_sgraph(0,0,3)
WINACHOICE(<expC1>)
This function emulates the ACHOICE function in its entirety, except the window
specifies the ACHOICE coordinates. The parameter is passed as a string.
ie, WINACHOICE("array1,array2,startat,scrlocat")
WINACHOICE("array1,.T.")
WINBROWSE()
This function emulates the BROWSE function except that the coordinates are not
specified. The window is used as the browse area.
ie, WINBROWSE()
WINMEMOEDIT(<expC1>)
This function emulates the MEMOEDIT function except that the coordinates are
not specified. The window is used as the memo area. The parameter is a string
exactly as one would use it during a normal memoedit use.
ie, WINMEMOEDIT(".F.,.T.)
WINTBNEW()
This function emulates the TBROWSENEW() function except the window forms the
coordinates.
ie, WINTBNEW()
WINTBDB()
This function emulates the TBROWSEDB() function except the window forms the
coordinates.
ie, WINTBDB()
Additional Notes:
All these functions are released as PUBLIC DOMAIN to the general CLIPPER
public. However, source code is available for a nominal fee from:
Matthew S. Staben
811 West 14th Avenue
Spokane, WA 99204
Attn: Clipper Stuff
Usage:
Specify the CLPWIN52.LIB as a library when linking.
If there are any requests for additional work involving CLIPPER, windowing
for CLIPPER, or any programming in general, the above address will generate
instant response.